// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 创建用户 role 支持 [ ROLE_GUEST , ROLE_ADMIN ]。 POST /api/users */
export async function createUser(body: API.UserCreateDto, options?: { [key: string]: any }) {
  return request<API.MessageDtoComposeUserResponseDto>('/api/users', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 获得用户 GET /api/users/${param0} */
export async function getUsersById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getUsersByIdParams,
  options?: { [key: string]: any },
) {
  const { user_id: param0, ...queryParams } = params;
  return request<API.MessageDtoComposeUserResponseDto>(`/api/users/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新用户信息 role 支持 [ ROLE_GUEST , ROLE_ADMIN ]。<br/>这接口不支持修改密码。 PUT /api/users/${param0} */
export async function updateUserDetails(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateUserDetailsParams,
  body: API.UserUpdateDetailsDto,
  options?: { [key: string]: any },
) {
  const { user_id: param0, ...queryParams } = params;
  return request<API.MessageDtoComposeUserResponseDto>(`/api/users/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 修改用户密码 PATCH /api/users/${param0}/password */
export async function updateUserPassword(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateUserPasswordParams,
  body: API.UserUpdatePasswordDto,
  options?: { [key: string]: any },
) {
  const { user_id: param0, ...queryParams } = params;
  return request<API.MessageDtoComposeUserResponseDto>(`/api/users/${param0}/password`, {
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 修改用户状态 PATCH /api/users/${param0}/status */
export async function updateUserStatus(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateUserStatusParams,
  body: API.UserUpdateStatusDto,
  options?: { [key: string]: any },
) {
  const { user_id: param0, ...queryParams } = params;
  return request<API.MessageDtoComposeUserResponseDto>(`/api/users/${param0}/status`, {
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 获得当前用户 GET /api/users/current */
export async function getCurrentUser(options?: { [key: string]: any }) {
  return request<API.MessageDtoComposeUserResponseDto>('/api/users/current', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获得用户列表 GET /api/users/page/${param0}/page_size/${param1} */
export async function getUsers(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getUsersParams,
  options?: { [key: string]: any },
) {
  const { page: param0, page_size: param1, ...queryParams } = params;
  return request<API.MessageDtoComposePageOfUsers>(
    `/api/users/page/${param0}/page_size/${param1}`,
    {
      method: 'GET',
      params: {
        ...queryParams,
      },
      ...(options || {}),
    },
  );
}
